//
//  SampleNetWorksTests.swift
//  SampleNetWorksTests
//
//  Created by apple on 15/3/4.
//  Copyright (c) 2015年 Ai. All rights reserved.
//

import UIKit
import XCTest


class SampleNetWorksTests: XCTestCase {
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    // 测试字符串
    func testQueryString(){
        let net = SampleNeworks()
        XCTAssertNil(net.queryString(nil), "应该为nil")
        
        println(net.queryString(["name":"xiaoming"])!)
        XCTAssert(net.queryString(["name":"xiaoming"])! == "name=xiaoming")
        
        println(net.queryString(["name":"xiaoming","age":"12"])!)
        XCTAssert(net.queryString(["name":"xiaoming","age":"12"])! == "age=12&name=xiaoming")
    }
    
    //测试Json
//    func testJson(){
//        let net = SampleNeworks()
//        net.requestJson("POST", urlString: "http://httpbin.org/get", params: <#[String : String]?#>, completion: <#(result: AnyObject?, error: NSError?) -> ()##(result: AnyObject?, error: NSError?) -> ()#>)
//    }
}
